Name Subleme
OutFile "Subleme.exe"
Caption "Subleme Installer"
InstallDir $PROGRAMFILES\TyleTools
InstallDirRegKey HKLM SOFTWARE\TyleTools "Install_Dir"

Page license
Page directory
Page instFiles
LicenseData "..\LICENSE.txt"

DirText "Select Installation Directory"

Section "Subleme (required)"
  ; Set output path to the installation directory.
  SetOutPath "$INSTDIR\http"
	File /r "..\export\*"

  WriteRegStr HKLM SOFTWARE\TyleTools "Install_Dir" "$INSTDIR"
  ; Write the uninstall keys for Windows
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Subleme" "DisplayName" "Subleme (remove only)"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Subleme" "UninstallString" '"$INSTDIR\http\uninstall.exe"'
  WriteUninstaller "http\uninstall.exe"
  Exec "$INSTDIR\http\subleme\setup.bat"
SectionEnd ; end the section

; optional section
Section "Start Menu Shortcuts"
	CreateDirectory "$SMPROGRAMS\TyleTools"
  CreateShortCut "$SMPROGRAMS\TyleTools\Subleme.lnk" "$INSTDIR\http\subleme\start.bat" "" "$INSTDIR\http\subleme\start.bat" 0
  CreateShortCut "$SMPROGRAMS\TyleTools\Subleme Setup.lnk" "$INSTDIR\http\subleme\setup.bat" "" "$INSTDIR\http\subleme\setup.bat" 0
  CreateShortCut "$SMPROGRAMS\TyleTools\Subleme Uninstall.lnk" "$INSTDIR\http\uninstall.exe" "" "$INSTDIR\http\uninstall.exe" 0
SectionEnd

;Section "Removing Data"
;	MessageBox MB_YESNO "Do you want to remove previous data?" IDNO no
;	Delete "$INSTDIR\Http\Subleme\data\*"
;no:
;SectionEnd

; uninstall stuff

UninstallText "This will uninstall Subleme. Hit next to continue."

; special uninstall section.
Section "Uninstall"
  ; remove registry keys
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Subleme"
  RMDir /r "$INSTDIR"
  ; remove shortcuts, if any.
  Delete "$SMPROGRAMS\TyleTools\Subleme*.*"
  ; remove directories used.
SectionEnd
